package com.example.roomwordssample;

import android.os.Bundle;
import android.util.Log;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.room.Room;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.main_activity);

        Log.d("zhoutao", "Room test");

        UserDao userDao = Room.databaseBuilder(getApplicationContext(),
                        AppDatabase.class, "app_database")
                .allowMainThreadQueries()
                .build().userDao();

        User user = new User();
        user.firstName = "zhou";
        user.lastName = "tao";
        userDao.insertAll(user);
    }
}